package com.vv.tools.modules.sys.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.vv.tools.common.constant.sys.UserGenderEnum;
import com.vv.tools.common.constant.sys.UserStatusEnum;
import com.vv.tools.common.support.BasePage;
import com.vv.tools.common.validator.AddGroup;
import com.vv.tools.common.validator.UpdateGroup;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.io.Serializable;
import java.util.List;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import io.swagger.v3.oas.annotations.media.Schema;

@Getter
@Setter
@ToString
@Schema(name = "User")
public class UserDTO extends BasePage implements Serializable {

    /**
     * 主键ID
     */
    @Schema(title = "ID")
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;


    /**
     * 用户名
     */
    @Schema(title = "用户名")
    @NotBlank(message = "用户名不能为空", groups = {AddGroup.class})
    @Size(min = 5, max = 50, message = "用户名长度限制5~50", groups = {AddGroup.class, UpdateGroup.class})
    private String username;

    /**
     * 密码
     */
    @Schema(title = "密码")
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class})
    @Size(min = 5, max = 50, message = "密码长度限制5~50", groups = {AddGroup.class})
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    /**
     * 昵称
     */
    @Schema(title = "昵称")
    private String nickname;

    /**
     * 生日: yyyy-MM-dd
     */
    @Schema(title = "生日: yyyy-MM-dd")
    private String birthday;

    /**
     * 性别(0-未知, 1-男, 2-女)
     */
    @Schema(title = "性别(0-未知, 1-男, 2-女)")
    private UserGenderEnum gender;

    /**
     * 邮箱
     */
    @Schema(title = "邮箱")
    private String email;

    /**
     * 手机
     */
    @Schema(title = "手机")
    private String phone;

    /**
     * 状态(0：禁用, 1：正常)
     */
    @Schema(title = "状态(0：禁用, 1：正常)")
    private UserStatusEnum status;

    @Schema(title = "角色")
    private List<String> roles;

}
